package com.xinziruo.richclient.support.command;

import com.xinziruo.richclient.support.command.impl.CrawlCommand;
import com.xinziruo.richclient.support.command.impl.OnlineCommand;
import com.xinziruo.richclient.support.command.impl.OutlineCommand;

import static com.xinziruo.richclient.support.command.CommandConstant.*;

/**
 * 
 * @author loudyn
 * 
 */
public class CommandFactory {

	/**
	 * 
	 * @param contentType
	 * @return
	 * @throws Exception
	 */
	public static Command newCommand(byte contentType) throws Exception {

		switch (contentType) {
		case ONLINE:
			return new OnlineCommand();
		case OUTLINE:
			return new OutlineCommand();
		case CRAWL:
			return new CrawlCommand();
		}

		throw new UnsupportedOperationException("Unkown command contentType!");
	}

}
